import {defineStore} from "pinia"
import {ref} from "vue";
import {setToken as utilSetToken} from "@/util";

export const useMainStore = defineStore("main", () => {
    const token = ref("")

    function setToken(rawToken: string) {
        token.value = rawToken
    }

    function getToken(): string {
        return token.value
    }

    function clearToken() {
        utilSetToken("")
        token.value = ""
    }

    return {
        setToken,
        getToken,
        clearToken
    }
})